FROM ruby:2.4.1

RUN apt-get update -qq && apt-get install -y build-essential libssl-dev git --fix-missing --no-install-recommends

# postgres
RUN apt-get install -y libpq-dev

# nokogiri
RUN apt-get install -y libxml2-dev libxslt1-dev

# minimagick
RUN apt-get install -y imagemagick libbz2-dev libjpeg-dev libevent-dev libmagickcore-dev libffi-dev libglib2.0-dev zlib1g-dev libyaml-dev

# qt for capybara capybara-webkit
RUN apt-get install -y qt5-default libqt5webkit5-dev gstreamer1.0-plugins-base gstreamer1.0-tools gstreamer1.0-x xvfb --fix-missing --no-install-recommends

# node js for coffee and sass
RUN curl -sL https://deb.nodesource.com/setup_5.x | bash -
RUN apt-get install -y nodejs

ENV APP_HOME /rails_app
RUN mkdir $APP_HOME
WORKDIR $APP_HOME

ADD Gemfile* $APP_HOME/
RUN bundle install

# postgres 配置
ENV DEV_DB_HOST pgdb
ENV TEST_DB_HOST pgdb
# redis
ENV REDIS_HOST redis
ADD . $APP_HOME
